from django.contrib import admin

# Register your models here.
from .models import *
from django.utils.html import format_html

admin.site.site_header = '相机商城'  # 页面头部的标题
admin.site.site_title = '相机商城后台管理'  # 浏览器标签页的标题

class OrderAdmin(admin.ModelAdmin):
    list_display =('id','uuid', 'sum', 'status', 'user')
    ordering = ('id',)

class OrderItemAdmin(admin.ModelAdmin):
    list_display =('id','order_image', 'order_name', 'order_price', 'order_count', 'Order','goods')
    ordering = ('id',)

    def order_image(self, obj):
        return format_html('<img src="/{}" style="width:100px;height:auto;">',obj.order_img)
admin.site.register(Order, OrderAdmin)
admin.site.register(OrderItem, OrderItemAdmin)